﻿using PC.PickleJar.Configuration;
using PC.PickleJar.Exceptions;
using PC.PickleJar.Helpers;
using PC.PickleJar.MSTest.Configuration;
using PC.PickleJar.Validators;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PC.PickleJar.MSTest.Helpers
{
	public class MSTestConfigurationHelper : ConfigurationHelper
	{
		private PickleJarMSTestSection configSection;

		public MSTestConfigurationHelper()
		{
			this.configSection = (PickleJarMSTestSection)ConfigurationManager.GetSection(PickleJarMSTestSection.SectionName);

			if (this.configSection == null)
			{
				throw new ConfigurationNotFoundException(PickleJarMSTestSection.SectionName);
			}
		}

		public String VisualStudioVersion
		{
			get
			{
				String result = MSTestConfigurationDefaults.VisualStudioVerion;

				if (this.configSection != null && !String.IsNullOrWhiteSpace(this.configSection.VisualStudio.Version))
				{
					result = this.configSection.VisualStudio.Version;
				}


				return result;
			}
		}

		public String CustomTestMethodInvokerTypeName
		{
			get
			{
				return this.configSection.CustomTestMethodInvoker.Type;
			}
		}
	}
}
